package com.ak.common.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.ArrayList;
import java.util.List;

/**
 * @author Vean
 */
@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
@EqualsAndHashCode(callSuper = false)
public class TreeEntity<T> extends BaseEntity {

    @TableField(exist = false)
    private Integer id;

    private Integer parentId;

    @TableField(exist = false)
    private String label;
    @TableField(exist = false)
    private List<TreeEntity<T>> children;
    @TableField(exist = false)
    private boolean hasParent = false;
    @TableField(exist = false)
    private boolean hasChildren = false;
    public void initChildren(){
        this.children = new ArrayList<>();
    }
}
